package com.sunfeng.elasticsearch.elastic.full;

import com.sunfeng.elasticsearch.utils.ClientUtils;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.index.query.IntervalsSourceProvider;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;

import java.io.IOException;
import java.util.ArrayList;

/**
 * @Author : 孙峰
 * @Description:
 * @Date : 2022/5/10  21:17
 */
public class IntervalsQuery {
    public static void main(String[] args) throws IOException {
        // 创建客户端对象
        RestHighLevelClient client = null;
        try {
            client = ClientUtils.getInstance();
            intervalsQuery(client);
        } finally {
            assert client != null;
            client.close();
        }
    }

    private static void intervalsQuery(RestHighLevelClient client) throws IOException {
        SearchRequest searchRequest = new SearchRequest().indices("kibana_sample_data_logs");

        SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
        ArrayList<IntervalsSourceProvider> sourceProviders = new ArrayList<>(16);
        //  this.query = query;
        //            this.maxGaps = maxGaps;
        //            this.ordered = ordered;
        //            this.analyzer = analyzer;
        //            this.filter = filter;
        //            this.useField = useField;
        IntervalsSourceProvider.IntervalFilter not_containing = new IntervalsSourceProvider.IntervalFilter(new IntervalsSourceProvider.Match("404", -1, false, "", null, ""), "not_containing");


    }
}
